/**
 * Created by hiibook on 2017/6/15.
 */
module.exports = function (req, res, next) {
    console.log("muApiPost服务器信息更新");
    var config = require('../config/config');
    var mysql = require('mysql');
    var connection = mysql.createConnection(config.mysql);
    connection.connect();
    var registeredStatus = null;
    var query = connection.query("UPDATE `" + config.mysql.database + "`.`ss_node` SET `load` = '" + req.body.load + "',`uptime` = '" + req.body.uptime + "' WHERE `ss_node`.`id` = " +req.params.id);//炒作数据库
    query
        .on('error', function (err) {
            console.log('数据库连接失败', err)
        })
        .on('result', function (row) {
            registeredStatus = row;
        })
        .on('end', function () {
            if (registeredStatus == null) {
                connection.end();
                res.sendStatus(500)
            } else {
                console.log("更新服务器状态信息完成");
                connection.end();
                res.sendStatus(200)
            }

        });


};